<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 多维数组求和，let的块级作用域
    function sumMatrix(number) {
      let sum = 0;
      for (let i = 0; i < number.length; i++) {
        var currentRow = number[i];
        for (let i = 0; i < currentRow.length; i++) {
          sum += currentRow[i]
        }
      }
      return sum
    }
    let arr = [[1, 2, 3], [4, 5, 6]]
    console.log(sumMatrix(arr))
  </script>
</body>

</html>